<?php

namespace App\GatewayWorker;

use GatewayWorker\Lib\Gateway;
use App\Services\WorkerService;

class Events
{
    public static function onWorkerStart($businessWorker)
    {
        echo 'BusinessWorker Start', PHP_EOL;
    }

    public static function onConnect($client_id)
    {
        Gateway::sendToClient($client_id, json_encode(['type' => 'init', 'client_id' => $client_id]));

    }

    public static function onWebSocketConnect($client_id, $data)
    {

        echo 'WebSocket Connect:', $client_id, PHP_EOL;

    }

    public static function onMessage($client_id, $message)
    {

    }

    public static function onClose($client_id)
    {
        echo 'close connection:', $client_id, PHP_EOL;
    }
}
